package com.example.mardan_demo1.controller;

import com.example.mardan_demo1.pojo.Result;
import com.example.mardan_demo1.pojo.WuZhiHuaHuiYi.DevicePojo;
import com.example.mardan_demo1.pojo.WuZhiHuaHuiYi.HuiYi;
import com.example.mardan_demo1.pojo.WuZhiHuaHuiYi.YiTi;
import com.example.mardan_demo1.service.WuZhiHuaHuiYiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.validation.constraints.NotNull;

/**
 * @Author:买尔旦江 ×@CreateTime: 2025-02-09
 * @Description: 无纸化会议控制器
 * @Version: 1.0
 */

@RestController
@RequestMapping("/huiyi-api")
public class WuZhiHuaHuiYiController {
    @Autowired
    private WuZhiHuaHuiYiService wuZhiHuaHuiYiService;
    /**
     * 新增会议
     */
    @PostMapping("/add-hui-yi")
    public Result addHuiYi(HuiYi huiYi) {
        return wuZhiHuaHuiYiService.addHuiYi(huiYi);
    }
    /**
     * 根据id获取会议信息
     */
    @PostMapping("/get-hui-yi-by-id")
    public Result getHuiYiById(Integer id) {
        return wuZhiHuaHuiYiService.getHuiYiById(id);
    }
    /**
     *获取会议列表
     */
    @PostMapping("/gethuiyilist")
    public Result getHuiYiList(Integer pageSize, Integer pageNum, String cname, String state) {
        return wuZhiHuaHuiYiService.getHuiYiList(pageSize, pageNum, cname, state);
    }
    /**
     * 客户获取ip地址
     */
    @PostMapping("/getIpAddressForClient")
    public Result getIpAddressForClient(HttpServletRequest request) {
        return wuZhiHuaHuiYiService.getIpAddressForClient(request);
    }
    /**
     * 新增议题
     */
    @PostMapping("/addyiti")
    public Result addYiTi(YiTi yiti){
        return wuZhiHuaHuiYiService.addYiTi(yiti);
    }
    /**
     * 根据id获取会议的议题
     */
    @PostMapping("/huoquhuiyiyitibyid")
    public Result getYiTiByHuiYiId(Integer id) {
        return wuZhiHuaHuiYiService.getYiTiByHuiYiId(id);
    }
    /**
     * 根据id删除会议
     */
    @PostMapping("/deletehuiyibyid")
    public Result deleteHuiYiById(Integer id) {
        return wuZhiHuaHuiYiService.deleteHuiYiById(id);
    }
    /**
     * 根据id获取议题信息
     */
    @PostMapping("/getyitibyid")
    public Result getYiTiById(Integer id) {
        return wuZhiHuaHuiYiService.getYiTiById(id);
    }
    /**
     *结束会议
     */
    @PostMapping("/jieshuhuiyi")
    public Result jieShuHuiYi(Integer id) {
        return wuZhiHuaHuiYiService.jieShuHuiYi(id);
    }
    /**
     *恢复会议
     */
    @PostMapping("/huifuhuiyi")
    public Result huiFuHuiYi(Integer id) {
        return wuZhiHuaHuiYiService.huiFuHuiYi(id);
    }
    /**
     * 编辑会议信息
     */
    @PostMapping("/updatehuiyibyid")
    public Result updateHuiYiById(HuiYi huiYi) {
        return wuZhiHuaHuiYiService.updateHuiYi(huiYi);
    }
    /**
     *删除议题
     */
    @PostMapping("/deleteYiTiById")
    public Result deleteYiTiById(Integer id) {
        return wuZhiHuaHuiYiService.deleteYiTiById(id);
    }
    /**
     * 按照顺序插入议题
     */
    @PostMapping("/insertTopicsInOrder")
    public Result insertTopicsInOrder(YiTi yiti ) {
        return  wuZhiHuaHuiYiService.insertTopicsInOrder(yiti);
    }
    /**
     *  上移议题
     */
    @PostMapping("/moveupTopics")
    public Result moveUpTopics(Integer topicId) {
        return  wuZhiHuaHuiYiService.moveUpTopics(topicId);
    }
    /**
     * 下移议题
     */
    @PostMapping("/movedownTopics")
    public Result moveDownTopics(Integer topicId) {
        return  wuZhiHuaHuiYiService.moveDownTopics(topicId);
    }
    /**
     * 删除议题并排序剩余的议题
     */
    @PostMapping("/deleteTopicAndSort")
    public Result deleteTopicAndSort(Integer topicId) {
        return  wuZhiHuaHuiYiService.deleteTopicAndSort(topicId);
    }
    /**
     * mac绑定过的用户获取会议列表
     */
    @PostMapping("/gethuiyilist-mac")
    public Result getMeetingListByMacAddresses() {
        return wuZhiHuaHuiYiService.getMeetingListByMacAddresses();
    }
    /**
     *ip地址绑定过的用户获取会议列表
     */
    @PostMapping("/gethuiyilistbyipaddress")
    public Result getMeetingListByIPAddress(HttpServletRequest request) {
        return wuZhiHuaHuiYiService.getMeetingListByIPAddress(request);
    }
    /**
     * 新增设备
     */
    @PostMapping("/addDevice")
    public Result addDevice(DevicePojo device){
        return wuZhiHuaHuiYiService.addDevice(device);
    }
    /**
     * 编辑设备
     */
    @PostMapping("/updateDeviceInfo")
    public Result updateDeviceInfo(DevicePojo device){
        return wuZhiHuaHuiYiService.updateDeviceInfo(device);
    }
    /**
     * 删除设备
     */
    @PostMapping("/deleteDeviceInfo")
    public Result deleteDeviceInfo(Integer id){
        return wuZhiHuaHuiYiService.deleteDeviceInfo(id);
    }
    /**
     * 获取设备列表
     */
    @PostMapping("/getDeviceList")
    public Result getDeviceList(@NotNull String ip,
                                @NotNull Integer pageNum,
                                @NotNull  Integer pageSize){
        return wuZhiHuaHuiYiService.getDeviceList(ip, pageNum, pageSize);
    }
    /**
     * 根据设备id获取设备信息
     */
    @PostMapping("/getDeviceInfoById")
    public Result getDeviceInfoById(Integer id){
        return wuZhiHuaHuiYiService.getDeviceInfoById(id);
    }
    /**
     * 被授权的用户获取会议列表
     */
    @PostMapping("/shouquan-yonghu-gethuiyilist")
    public Result getMeetingListByShouquanYonghu(HttpServletRequest request) {
        return wuZhiHuaHuiYiService.getMeetingListByShouquanYonghu( request);
    }



















}
